package com.google.code.maven.plugin.http.client.config;

import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

import org.springframework.util.Assert;

/**
 * 
 * @author 797409
 * 
 */
public class BeanProperty {

	/**
	 * @parameter
	 */
	private String name;

	/**
	 * @parameter
	 */
	private String value;

	/**
	 * @parameter
	 */
	private String ref;

	/**
	 * @parameter
	 */
	private String[] array;

	/**
	 * @parameter
	 */
	private List<String> list;

	/**
	 * @parameter
	 */
	private Set<String> set;

	/**
	 * @parameter
	 */
	private Map<String, String> map;

	/**
	 * @parameter
	 */
	private Properties properties;

	public void validate() {
		Assert.notNull(name, "a bean property name can not be null");
		int defined = 0;
		defined += value != null ? 1 : 0;
		defined += ref != null ? 1 : 0;
		defined += array != null ? 1 : 0;
		defined += list != null ? 1 : 0;
		defined += set != null ? 1 : 0;
		defined += map != null ? 1 : 0;
		defined += properties != null ? 1 : 0;
		Assert.isTrue(defined < 2, "multiple bean property values");
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * @param value the value to set
	 */
	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * @return the ref
	 */
	public String getRef() {
		return ref;
	}

	/**
	 * @param ref the ref to set
	 */
	public void setRef(String ref) {
		this.ref = ref;
	}

	/**
	 * @return the array
	 */
	public String[] getArray() {
		return array;
	}

	/**
	 * @param array the array to set
	 */
	public void setArray(String[] array) {
		this.array = array;
	}

	/**
	 * @return the list
	 */
	public List<String> getList() {
		return list;
	}

	/**
	 * @param list the list to set
	 */
	public void setList(List<String> list) {
		this.list = list;
	}

	/**
	 * @return the set
	 */
	public Set<String> getSet() {
		return set;
	}

	/**
	 * @param set the set to set
	 */
	public void setSet(Set<String> set) {
		this.set = set;
	}

	/**
	 * @return the map
	 */
	public Map<String, String> getMap() {
		return map;
	}

	/**
	 * @param map the map to set
	 */
	public void setMap(Map<String, String> map) {
		this.map = map;
	}

	/**
	 * @return the properties
	 */
	public Properties getProperties() {
		return properties;
	}

	/**
	 * @param properties the properties to set
	 */
	public void setProperties(Properties properties) {
		this.properties = properties;
	}

}
